using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;

namespace tutFuelCellGame
{
    /// <summary>
    /// Manages the list of fuelcells in the game
    /// </summary>
    public class FuelCells
    {
        List<FuelCell> list = new List<FuelCell>();

        public int CountRetrieved
        {
            get { return list.Count((x) => x.Retrieved); }
        }

        public void Update(BoundingSphere fuelCarrierBounds)
        {
            list.ForEach((x) => x.Update(fuelCarrierBounds));
        }


        public void Reset()
        {
            list.ForEach(x => x.Reset());
        }

        public void Add(FuelCell fc)
        {
            list.Add(fc);
        }

        public void Clear()
        {
            list.Clear();
        }

        public void ForEach(Action<FuelCell> action)
        {
            list.ForEach(action);
        }

        public FuelCell Find(Predicate<FuelCell> predicate)
        {
            return list.Find(predicate);
        }
    }
}